package bishi.tengxun;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/08/22 20:54
 */
public class three1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T > 0) {
            int n = in.nextInt();
            int maxWeight = in.nextInt();
            int[] weights = new int[n];
            int index = 0;
            while (index < n) {// 注意，如果输入是多个测试用例，请通过while循环处理多个测试用例
                weights[index++] = in.nextInt();
            }
            int res = 0;
            Arrays.sort(weights);
            int left = 0, right = n - 1;
            boolean[] ok = new boolean[n];
            Arrays.fill(ok, false);
            while (left < right) {
                //一人一船
                while (left < right && (ok[right] || weights[right] + weights[left] > maxWeight)) {
                    if (!ok[right]) {
                        res++;
                        ok[right] = true;
                    }
                    right--;
                }
                int nowL = left;
                while (nowL < right && (weights[nowL] + weights[right]) % 2 != 0) {
                    if ((weights[nowL] + weights[right]) > maxWeight) break;
                    nowL++;
                }

                //两人一船
                if (nowL < right && (weights[nowL] + weights[right]) <= maxWeight) {
                    ok[right] = true;
                    ok[nowL] = true;
                    right--;
                    res++;
                } else {//一人一船
                    ok[right] = true;
                    right--;
                    res++;
                }

                //保证right为最右未处理，保证left为最左未处理。
                while (left < right && ok[left]) left++;
                while (left < right && ok[right]) right--;
            }
            System.out.println(res+(!ok[right]?1:0));
            T--;
        }
    }
}